{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import qrcode \n",
    "import pandas as pd\n",
    "def makeqrcode(str,path):\n",
    "    img = qrcode.make(str)\n",
    "    with open(path, 'wb') as f:\n",
    "        img.save(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "file = \"C:\\\\Users\\\\Administrator\\\\2021.10.14生成二维吗相关\\\\产品数据.xls\"\n",
    "data = pd.read_excel(file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "row=data.shape[0]\n",
    "col=data.shape[1]\n",
    "for i in range(1,row):\n",
    "    str1=\"器材代码: \"+data.iloc[i,0]+\"\\n\"\n",
    "    str2=\"器材名称: \"+data.iloc[i,1]+\"\\n\"\n",
    "    str3=\"规格型号: \"+data.iloc[i,2]+\"\\n\"\n",
    "    str4=\"数量 :      \"+str(data.iloc[i,3])+\"\\n\"\n",
    "    str5=\"单位:     \"+\"\"+\"\\n\"\n",
    "    str6=\"技术参数: \"+\"\"+\"\\n\"\n",
    "    str7=\"单价:     \"+\"\"+\"\\n\"\n",
    "    str8=\"生产厂家: \"+data.iloc[i,7]+\"\\n\"\n",
    "    str9=\"批次号 :   \"+data.iloc[i,8]+\"\\n\"\n",
    "    str10=\"等级 :      \"+data.iloc[i,9]+\"\\n\"\n",
    "    str11=\"生产日期:  \"+data.iloc[i,10]+\"\\n\"\n",
    "    str12=\"保管年限:  \"+\"\"+\"\\n\"\n",
    "    strT=str1+str2+str3+str4+str5+str6+str7+str8+str9+str10+str11+str12\n",
    "    path=\"{:0>3d}\".format(i)+data.iloc[i,0]+\".png\"\n",
    "    makeqrcode(strT,path)    \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
